Skip to content

Implemented Containerization of the Lyra Webapp #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 63 commits into from
Jun 6, 2025
Merged

Conversation

henrycatalinismith
Copy link
Collaborator

@henrycatalinismith henrycatalinismith commented Feb 1, 2025

Description

Added containerization to the lyra project to be able to run the whole thing inside of a container.
Read through the Docker setup section within the README.md for more details on how this works.

@xela1601
Copy link
Collaborator

xela1601 commented Feb 2, 2025

Copying over @henrycatalinismith 's PR description here to not override it:

Not fully working yet but lots of annoying obstacles cleared so far. Here's the error message as of the end of the day.

--- ~/lyra ‹main* M› » make docker_run
docker run -it \
		-v /Users/henrycatalinismith/lyra/lyra/config/docker.yaml:/app/config/projects.yaml \
		-v /Users/henrycatalinismith/lyra/test-001:/projects/test-001 \
		-p 3000:3000 \
		lyra
  ▲ Next.js 14.2.15
  - Local:        http://769f01fc1fc2:3000
  - Network:      http://172.17.0.2:3000

 ✓ Starting...
 ✓ Ready in 64ms
loading
a [Error]: unable to fork
    at Object.onError (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:44708)
    at /app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:18797
    at new Promise (<anonymous>)
    at W.handleTaskData (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:18556)
    at W.<anonymous> (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:18181)
    at Generator.next (<anonymous>)
    at o (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:4300)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  task: {
    commands: [ 'pull' ],
    format: 'utf-8',
    parser: [Function: parser],
    onError: [Function: onError]
  },
  git: ef {
    remote: '',
    hash: { local: '', remote: '' },
    branch: { local: '', remote: '' },
    message: 'unable to fork'
  },
  digest: '4075981265'
}
a [Error]: unable to fork
    at Object.onError (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:44708)
    at /app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:18797
    at new Promise (<anonymous>)
    at W.handleTaskData (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:18556)
    at W.<anonymous> (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:18181)
    at Generator.next (<anonymous>)
    at o (/app/webapp/.next/standalone/webapp/.next/server/chunks/871.js:26:4300)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  task: {
    commands: [ 'pull' ],
    format: 'utf-8',
    parser: [Function: parser],
    onError: [Function: onError]
  },
  git: ef {
    remote: '',
    hash: { local: '', remote: '' },
    branch: { local: '', remote: '' },
    message: 'unable to fork'
  },
  digest: '4075981265'
}

@xela1601 xela1601 changed the title Dockerfile progress for the day Implemented Containerization of the Lyra Webapp Feb 2, 2025
@xela1601 xela1601 closed this Feb 2, 2025
@xela1601 xela1601 force-pushed the issue-156/dockerfile branch from 4801da3 to 7c8e25b Compare February 2, 2025 11:31
@xela1601 xela1601 reopened this Feb 2, 2025
@xela1601 xela1601 marked this pull request as ready for review February 2, 2025 11:34
@xela1601 xela1601 force-pushed the issue-156/dockerfile branch from 790557d to ed66bc6 Compare February 2, 2025 11:48
@xela1601
Copy link
Collaborator

xela1601 commented Feb 2, 2025

there's still some issue with the unit tests that needs to be addressed

@xela1601
Copy link
Collaborator

xela1601 commented Feb 2, 2025

Also i just noticed that the publishing of translation changes is not working at the moment.

 Error while creating pull request: Error: fatal: ../zetkin-fork-for-lyra/src/locale/da.yml: '../zetkin-fork-for-lyra/src/locale/da.yml' is outside repository at '/app/zetkin-fork-for-lyra'

This is some weird issue with the paths that are being used throughout the webapp.
I'd propose we just configure all the paths being used in one central location...

What do you think?

@WULCAN
Copy link
Collaborator

WULCAN commented Feb 2, 2025

Also i just noticed that the publishing of translation changes is not working at the moment.

 Error while creating pull request: Error: fatal: ../zetkin-fork-for-lyra/src/locale/da.yml: '../zetkin-fork-for-lyra/src/locale/da.yml' is outside repository at '/app/zetkin-fork-for-lyra'

This is some weird issue with the paths that are being used throughout the webapp. I'd propose we just configure all the paths being used in one central location...

What do you think?

That looks like a bug in Lyra. If I recall correctly, we convert to absolute paths pretty early after reading projects.yaml but we must have made a mistake somewhere. Will you create a separate issue for this bug?

I'm not sure exactly what you are suggesting with configuring all paths in a central location. Our configuration file projects.yaml could be considered that already.

Copy link
Collaborator

@WULCAN WULCAN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed all the changes and leave my notes here. I haven't done any testing yet.

I haven't concluded what needs fixing and what can be deferred to later, except for the one about copying config into the container image. That one seems like a serious issue to me.

@xela1601 xela1601 force-pushed the issue-156/dockerfile branch 2 times, most recently from 6d4350b to 38613d7 Compare February 2, 2025 19:56
@xela1601 xela1601 force-pushed the issue-156/dockerfile branch 3 times, most recently from dc564fe to 23d3297 Compare February 15, 2025 21:13
henrycatalinismith and others added 6 commits February 15, 2025 22:35
Signed-off-by: Alexander Schreiner <[email protected]>
Signed-off-by: Alexander Schreiner <[email protected]>
since it contains the github token which should not be inside of the image

Signed-off-by: Alexander Schreiner <[email protected]>
- improved logging
- introduced dynamic .yml and .yaml support for configuration
- added host projects config
- only copying webapp folder into builder stage
- bumping up to node version 23
- adding git username/password to docker env variables
- adjusted README

Signed-off-by: Alexander Schreiner <[email protected]>
@xela1601 xela1601 force-pushed the issue-156/dockerfile branch from 23d3297 to 83f84ef Compare February 15, 2025 21:38
@xela1601 xela1601 force-pushed the issue-156/dockerfile branch from 7dff829 to f497ccb Compare May 28, 2025 09:02
@WULCAN
Copy link
Collaborator

WULCAN commented May 29, 2025

Note that:

  1. 5a929c5 was pushed with 5206e0b as parent but later replaced by e052c82 with a force push.
  2. 7dff829 was pushed with c15aa47 as parent but then replaced by f497ccb with a force push.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My npm 10.9.2 cannot reproduce the package-lock.json of 607027a from the corresponding package.json. That doesn't mean its wrong, but I think we need to understand why it's different. What tool did you use and how?

@@ -21,7 +21,7 @@
"@mui/material-nextjs": "^5.16.8",
"@mui/x-tree-view": "^7.23.0",
"@octokit/rest": "^20.1.1",
"next": "14.2.15",
"next": "^14.2.29",
Copy link
Collaborator

@WULCAN WULCAN May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use two modules form the same project: next and eslint-config-next. The Next project expects them to be in sync.

"eslint-config-next": "14.2.15",

Actually, we also depend on a really fishy eslint-plugin-next 0.0.0 but let's handle that in a separate issue: #197

README.md Outdated

```bash
npm run build
node webapp/.next/standalone/lyra/webapp/server.js --check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag --check tells Node to check the script's syntax without executing it. Does this really help to catch missing dependencies?

Copy link
Collaborator

@xela1601 xela1601 Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no - it doesn't help catch missing dependencies. You have any idea how we could achieve this?

Copy link
Collaborator

@WULCAN WULCAN Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think we'll just have to rely on manual testing. Now that we are using outputFileTracingRoot, we're following their instructions and the risk of they breaking it in a new version of Next is much lower.

I don't think we need any special note to developers to do careful manual testing when they upgrade Next. A developer will do some testing anyway naturally and that is sufficient.

xela1601 added 12 commits June 5, 2025 20:56
Signed-off-by: Alexander Schreiner <[email protected]>
… a flag to node, and not to server.js

Signed-off-by: Alexander Schreiner <[email protected]>
…projects to readme

Signed-off-by: Alexander Schreiner <[email protected]>
Signed-off-by: Alexander Schreiner <[email protected]>
…ed because we only need to support x86 arch

Signed-off-by: Alexander Schreiner <[email protected]>
@xela1601 xela1601 force-pushed the issue-156/dockerfile branch from 70a4099 to 255964f Compare June 6, 2025 11:23
Copy link
Collaborator

@WULCAN WULCAN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally reviewed the changes from #161 too. I didn't find anything there that blocks merge but I found another issue from 255964f that I want fixed before merge.

Comment on lines +6 to +7
- '*.*.*'
- '*.*.*-rc.*'
Copy link
Collaborator

@WULCAN WULCAN Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern *.*.*-rc.* is already covered by the pattern *.*.* which allows any string as long it contains to dots.

Let's remove the second pattern or rewrite this to more specific patterns in a separate issue #201 rather than delaying merge futher. You can resolve this conversation when you have read it.


steps:
- name: Checkout repository
uses: actions/checkout@v3
Copy link
Collaborator

@WULCAN WULCAN Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 3 of actions/checkout has not been maintained for a while. I don't think there's any known severe issue with using v3 so we can update to v4 in a separate merge request. I created a separate issue #202 to track that instead of delaying merge further. You can resolve this conversation when you have read it.

uses: docker/setup-docker-action@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
Copy link
Collaborator

@WULCAN WULCAN Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 2 of docker/login-action is not maintained. I created a separate issue #202 for updating to v3 instead of delaying this merge request further. You can resolve this conversation when you have read it.

This was referenced Jun 6, 2025
@WULCAN WULCAN mentioned this pull request Jun 6, 2025
amerharb and others added 2 commits June 6, 2025 16:58
@xela1601 xela1601 merged commit 8a8e581 into main Jun 6, 2025
1 check passed
@xela1601 xela1601 deleted the issue-156/dockerfile branch June 6, 2025 15:55
@henrycatalinismith
Copy link
Collaborator Author

omfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dockerize it
4 participants